<template>
  <form>
    <div>邮箱:<input type="text" v-model="email" /></div>
    <div>密码:<input type="password" v-model="password" /></div>
    <div><button @click.prevent="login">登录</button></div>
  </form>
</template>

<script>
  export default {
    data() {
      return {
        email: '',
        password: ''
      }
    },
    methods: {
      login() {
        // console.log(this.email, this.password);
        let userStr = localStorage.getItem("user");
        const userObj = JSON.parse(userStr);
        if (this.email == userObj[0].email && this.password == userObj[0].password) {
          this.$router.push('/about');
          localStorage.setItem("apiKey", "666");
        }
      }
    }
  }
</script>

<style>
</style>
